package com.ask.service.impl;

import com.ask.dao.AnswerMongoRepository;
import com.ask.dto.AnswerParam;
import com.ask.model.Answer;

import com.ask.service.AnswerService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;


@Service
public class AnswerServiceImp implements AnswerService {
    @Autowired
    private AnswerMongoRepository answerMongoRepository;

    /**
     * 提问
     */
    @Override
    public Answer answer(AnswerParam answerParam){
        Answer answer = new Answer();
        answer.setQuestionId(answerParam.getQuestionId());
        answer.setAnswerId(answerParam.getAnswerId());
        answer.setContent(answerParam.getContent());
        answer.setAnonymous(answerParam.getAnonymous());
        answer.setImgUrl(answerParam.getImgUrl());
        answerMongoRepository.save(answer);
        return answer;
    }
}
